#Copyright (c) 2025, Alibaba Cloud and its affiliates;
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at

#   http://www.apache.org/licenses/LICENSE-2.0

#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#limitations under the License.

import sys
import sqlite3
import argparse

parser = argparse.ArgumentParser(description="change sqlite options")

parser.add_argument('--table', choices=['job_template', 'user'])
parser.add_argument('--operation', choices=['add', 'delete'])

args = parser.parse_args() 


if args.table == 'job_template' and args.operation == 'add':
    sql = 'ALTER TABLE job_templates ADD COLUMN command_params VARCHAR(255);'
else:
    print('Not available')
    sys.exit(0)


def db_execute(db,sql):
    cur = db.cursor()
    cur.execute(sql)
    db.commit()


if __name__ == '__main__':
    con = sqlite3.connect('/usr/local/fce/fce-server/sqlite.db')
    db_execute(con,sql)

